using System;
using Unity.Entities;

namespace Gj
{
    public enum AI_COMMAND
    {
        // 对目标施放
        TargetCast = 0,
        PositionCast = 1,

        // 帮助
        Help = 2,

        // 巡逻
        Patrol = 3,

        // 逃跑
        Escape = 4,

        // 待命
        Standby = 5,

        // 求救
        Sos = 6,

        // 散步
        Stroll = 7,

        // 跟随
        Follow = 8
    }

    [Serializable]
    public enum AiBrainState : byte
    {
        Wait,
        Judge,
        WaitRun,
        Run
    }

    public struct AiData : IComponentData
    {
        public int scanRadius;
        public int partnerRadius;
        public int maxIndex;
        public Entity group;
    }

    public struct AiSelectData : IComponentData
    {
        public int commandIndex;
        public bool filter;
        public double time;
    }

    public struct AiLastCommandData : IComponentData
    {
        public int commandIndex;
        public Entity entity;
        public double time;
    }

    [Serializable]
    public struct AiBrainStateData : ISharedComponentData
    {
        public AiBrainState state;

        public bool Equals(AiBrainStateData data)
        {
            return state != data.state;
        }
    }

    public struct AiLockStateData : IComponentData
    {
    }

    public struct AiRunStateData : IComponentData
    {
    }

    public struct AiTeamData : IComponentData
    {
        public AI_COMMAND aiCommand;
    }

    public struct AiGroupData : IComponentData
    {
        public double time;
    }

    public struct AiWaitGroupData : IComponentData
    {
    }

    public struct AiTargetBuffer : IBufferElementData
    {
        public Entity entity;
    }

    public struct AiEnemyBuffer : IBufferElementData
    {
        public Entity entity;
    }

    public struct AiPartnerBuffer : IBufferElementData
    {
        public Entity entity;
    }
}